home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 873 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.1 KB

  1. From: clamage@Eng.Sun.COM (Steve Clamage)
  2. Message-ID: <4jbqog$78i@engnews1.Eng.Sun.COM>
  3. X-Original-Date: 27 Mar 1996 16:35:28 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 27 Mar 96 17:13:16 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: "explicit" default constructor?
  9. Organization: Sun Microsystems Inc.
  10. References: <31588662.F1@cs.tu-berlin.de>
  11. Reply-To: clamage@Eng.Sun.COM
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMVl3S+EDnX0m9pzZAQHTIwF+JHP5x9UVfkFmatzu4c51yo3+IVzMGnPz
  14.     KA98gXFoyYF5wnwLfsIf3RzEglpSrGfB
  15.     =NQOp
  16.  
  17. In article F1@cs.tu-berlin.de, Roman Lechtchinsky <wolfro@cs.tu-berlin.de>
  18. writes:
  19.  
  20. >as I read the section [class.conv.ctor] of the DWP, I get the impression that
  21. >the description of converting and non-converting constructors applies to all 
  22. >constructors, i.e. a constructor is either converting or non-converting. A 
  23. >non-converting constructor creates an object "only where a constructor call 
  24. >is  explicitly  indicated by the syntax". This has no implications on 
  25. >constructors with more than one parameter, but what about the default 
  26. >constructor? Should a default constructor call be really indicated by the 
  27. >syntax and if so, how is it to be done? What if the default constructor is 
  28. >declared "explicit"? 
  29.  
  30. A converting constructor is one which can be called with a single parameter.
  31. The default constructor isn't a converting constructor except in the
  32. case of a constructor with all parameters having default values.
  33.  
  34. If a constructor has no parameters, declaring it "explicit" has no effect,
  35. since it can never be invoked for a conversion.
  36.  
  37. If a constructor's parameters all have default values, it can be a converting
  38. constructor, and declaring it "explicit" prevents it from being invoked
  39. implicitly.
  40. ---
  41. Steve Clamage, stephen.clamage@eng.sun.com
  42. ---
  43. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  44. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  45. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  46. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  47. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  48.